{include file="public/header" /}
<!--main content start-->
<section class="main-content-wrapper">
    <section id="main-content">
        <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">会员添加</h3>
                </div>
                <div class="panel-body">
                <form action="/admin/users/users_save" method="post" enctype="multipart/form-data" class="form-horizontal form-border">
                    <input name="id" value="{$id|default=''}" type="hidden">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">会员昵称：</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="name" placeholder="会员昵称" value="{$name|default=''}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">手机号：</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="phone" placeholder="手机号" value="{$phone|default=''}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">密码：</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" name="password" placeholder="用户密码" value="{$password|default=''}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">用户头像：</label>
                        <div class="col-sm-8">
                            <div class="col-sm-8">
                                <!--<input type="file" name="img">-->
                                <!--<p class="help-block">建议尺寸150*100.</p>-->
                                <input type="file" name="image" id="imgOne" onchange="preImg(this.id,'imgPre');" />
                                <p class="help-block">建议尺寸150*100.</p>
                                <img id="imgPre" src="{$head_url|default='/web_admin/img/nopic.png'}" width="150px" height="100px" style="display: block;" />
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">状态：</label>
                        <div class="col-sm-4">
                            <input type="radio" name="status" value="1" {if isset($status)}{if condition="($status == 1) "} checked {else /}{/if}{else /}checked{/if}>正常 &nbsp;
                            <input type="radio" name="status" value="2" {if isset($status)}{if condition="($status == 2)"} checked {else /}{/if{/if}{else /}{/if}}>冻结
                        </div>
                    </div>

                    <div class="panel-body">
                        <button type="submit" class="btn btn_5 btn-lg btn-default w_update">发布</button>
                    </div>
                </form>
                </div>
            </div>
        </div>
        </div>
    </section>
</section>
<style>
    @media (min-width: 768px){
        .form-horizontal .control-label {
             text-align: left;
        }
    }
</style>
<script>
    /**
     * 从 file 域获取 本地图片 url
     */
    function getFileUrl(sourceId) {
        var url;
        if (navigator.userAgent.indexOf("MSIE")>=1) { // IE
            url = document.getElementById(sourceId).value;
        } else if(navigator.userAgent.indexOf("Firefox")>0) { // Firefox
            url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0));
        } else if(navigator.userAgent.indexOf("Chrome")>0) { // Chrome
            url = window.URL.createObjectURL(document.getElementById(sourceId).files.item(0));
        }
        return url;
    }
    /**
     * 将本地图片 显示到浏览器上
     */
    function preImg(sourceId, targetId) {
        var url = getFileUrl(sourceId);
        var imgPre = document.getElementById(targetId);
        imgPre.src = url;
    }
</script>
<!--main content end-->
{include file="public/footer" /}